<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
  <title>发现美食 - 美食外卖平台</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <style>
    :root {
      --primary: #FF6B6B;
      --secondary: #FFE8E8;
      --text: #333;
      --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
      --radius-lg: 20px;
      --radius-md: 12px;
      --transition: all 0.3s ease;
      --content-max-width: 1200px;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: 'Helvetica Neue', system-ui;
    }

    body {
      background: #F8F9FA;
      color: var(--text);
      padding-bottom: 80px;
    }

    /* 头部样式 */
    .header {
      position: fixed;
      top: 0;
      width: 100%;
      background: white;
      padding: 12px 0;
      box-shadow: var(--shadow-sm);
      z-index: 1000;
      display: flex;
      justify-content: center;
    }

    .header-content {
      width: 100%;
      max-width: var(--content-max-width);
      padding: 0 20px;
    }

    .search-bar {
      width: 100%;
      max-width: 800px;
      margin: 0 auto;
      transition: var(--transition);
    }

    .search-input {
      width: 100%;
      padding: 12px 25px;
      border: 2px solid var(--primary);
      border-radius: 30px;
      font-size: 16px;
      transition: var(--transition);
    }

    /* 发现页内容 */
    .discover-container {
      padding: 90px 0 30px;
      max-width: var(--content-max-width);
      margin: 0 auto;
    }

    /* 筛选标签 */
    .filter-tags {
      display: flex;
      gap: 10px;
      padding: 15px 20px;
      overflow-x: auto;
      scrollbar-width: none;
      position: sticky;
      top: 70px;
      background: white;
      z-index: 999;
      box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .filter-tags::-webkit-scrollbar {
      display: none;
    }

    .filter-tag {
      padding: 8px 20px;
      border-radius: 20px;
      background: var(--secondary);
      color: var(--primary);
      cursor: pointer;
      transition: var(--transition);
      white-space: nowrap;
      border: 1px solid transparent;
      font-size: 14px;
      flex-shrink: 0;
    }

    .filter-tag.active {
      background: var(--primary);
      color: white;
      border-color: var(--primary);
      transform: scale(1.05);
    }

    /* 内容区块 */
    .featured-section {
      padding: 20px;
      margin: 20px 0;
    }

    .section-title {
      font-size: 24px;
      margin-bottom: 20px;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 0 20px;
    }

    .section-title i {
      color: var(--primary);
    }

    /* 横向滚动 */
    .dish-scroll {
      display: flex;
      gap: 20px;
      overflow-x: auto;
      padding: 0 20px 15px;
      scrollbar-width: thin;
      scrollbar-color: var(--primary) var(--secondary);
    }

    .dish-scroll::-webkit-scrollbar {
      height: 6px;
    }

    .dish-scroll::-webkit-scrollbar-thumb {
      background: var(--primary);
      border-radius: 4px;
    }

    /* 统一卡片 */
    .dish-card {
      min-width: 280px;
      background: white;
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-sm);
      transition: var(--transition);
      overflow: hidden;
      opacity: 0;
      transform: translateY(20px);
      display: flex;
      flex-direction: column;
    }

    .dish-card.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .dish-card:hover {
      transform: translateY(-5px);
      box-shadow: var(--shadow-md);
    }

    .dish-image {
      height: 180px;
      width: 100%;
      object-fit: cover;
      border-bottom: 2px solid var(--primary);
    }

    .dish-info {
      padding: 15px;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .dish-info h3 {
      font-size: 18px;
      margin-bottom: 4px;
    }

    .price-tag {
      color: var(--primary);
      font-weight: 800;
      font-size: 18px;
      margin-top: auto;
    }

    /* 评分 */
    .rating {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      background: #fff3e0;
      padding: 4px 12px;
      border-radius: 20px;
      color: #ff9800;
      font-size: 14px;
      width: fit-content;
    }

    /* 商家标签 */
    .badge {
      background: var(--secondary);
      color: var(--primary);
      padding: 4px 12px;
      border-radius: 14px;
      font-size: 12px;
      font-weight: 500;
      width: fit-content;
    }

    /* 推荐商家 */
    .recommended-grid {
      display: grid;
      gap: 25px;
      padding: 0 20px;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    /* 底部导航 */
    .bottom-nav {
      position: fixed;
      bottom: -65px;
      width: 100%;
      background: white;
      display: flex;
      justify-content: space-around;
      padding: 12px 0;
      box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
      z-index: 1001;
      transition: transform 0.3s ease;
    }

    .nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      color: #666;
      transition: var(--transition);
      text-decoration: none;
      font-size: 12px;
      padding: 8px;
      border-radius: 12px;
    }

    .nav-item i {
      font-size: 20px;
    }

    .nav-item.active {
      color: var(--primary);
      background: var(--secondary);
    }

    /* 登录提示条 */
    .login-prompt {
      position: fixed;
      bottom: 70px;
      left: 0;
      right: 0;
      background: rgba(0,0,0,0.95);
      color: white;
      padding: 12px 20px;
      display: none;
      align-items: center;
      justify-content: space-between;
      z-index: 1000;
      animation: slideUp 0.3s ease-out;
      border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .login-content {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 14px;
    }

    .login-content i {
      color: var(--primary);
    }

    .login-button {
      background: var(--primary);
      color: white;
      padding: 8px 25px;
      border-radius: 20px;
      text-decoration: none;
      font-weight: 500;
      transition: var(--transition);
      white-space: nowrap;
      font-size: 14px;
      border: 2px solid transparent;
    }

    .login-button:hover {
      background: white;
      color: var(--primary);
      border-color: var(--primary);
    }

    @keyframes slideUp {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }

    @media (min-width: 768px) {
      .login-prompt {
        max-width: 480px;
        margin: 0 auto;
        bottom: 80px;
        border-radius: var(--radius-md);
      }
    }

    @media (max-width: 1240px) {
      .header-content {
        padding: 0 20px;
      }
    }

    @media (max-width: 768px) {
      .filter-tags {
        padding-left: 20px;
      }

      .dish-card {
        min-width: 260px;
      }

      .section-title {
        font-size: 20px;
      }

      .recommended-grid {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 480px) {
      .search-input {
        padding: 10px 20px;
      }

      .filter-tags {
        top: 60px;
      }

      .dish-image {
        height: 160px;
      }
    }
  </style>
</head>
<body>
<header class="header">
  <div class="header-content">
    <div class="search-bar">
      <input type="text" class="search-input" placeholder="🔍 搜索美食、商家...">
    </div>
  </div>
</header>

<!-- 登录提示条 -->
<div class="login-prompt" id="loginPrompt">
  <div class="login-content">
    <i class="fas fa-exclamation-circle"></i>
    <span>登录后可以查看订单、收藏和优惠券</span>
  </div>
  <a href="It'smine.html" class="login-button">立即登录</a>
</div>

<main class="discover-container">
  <div class="filter-tags">
    <div class="filter-tag active">全部</div>
    <div class="filter-tag">附近推荐</div>
    <div class="filter-tag">折扣优惠</div>
    <div class="filter-tag">新店开业</div>
    <div class="filter-tag">高分好评</div>
  </div>

  <section class="featured-section">
    <h2 class="section-title">
      <i class="fas fa-fire"></i>
      今日爆款菜品
    </h2>
    <div class="dish-scroll">
      <article class="dish-card visible">
        <img src="https://images.unsplash.com/photo-1552566626-52f8b828add9?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80"
             class="dish-image"
             alt="招牌麻辣香锅">
        <div class="dish-info">
          <h3>招牌麻辣香锅</h3>
          <div class="rating">
            <i class="fas fa-star"></i>4.8
          </div>
          <p>🔥 本周热销Top1</p>
          <p class="price-tag">¥38</p>
        </div>
      </article>
      <article class="dish-card visible">
        <img src="https://images.unsplash.com/photo-1552566626-52f8b828add9?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80"
             class="dish-image"
             alt="日式寿司拼盘">
        <div class="dish-info">
          <h3>寿司盛宴</h3>
          <div class="rating">
            <i class="fas fa-star"></i>4.9
          </div>
          <p>🎌 新品上市</p>
          <p class="price-tag">¥68</p>
        </div>
      </article>
    </div>
  </section>

  <section class="featured-section">
    <h2 class="section-title">
      <i class="fas fa-thumbs-up"></i>
      附近推荐商家
    </h2>
    <div class="recommended-grid">
      <article class="dish-card visible">
        <img src="https://images.unsplash.com/photo-1552566626-52f8b828add9?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80"
             class="dish-image"
             alt="和风亭日料">
        <div class="dish-info">
          <h3>和风亭日料</h3>
          <div class="rating">
            <i class="fas fa-star"></i>4.9
          </div>
          <div class="badge">🎌 新店开业 88折</div>
          <p class="price-tag">人均 ¥98</p>
        </div>
      </article>
      <article class="dish-card visible">
        <img src="https://images.unsplash.com/photo-1552566626-52f8b828add9?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80"
             class="dish-image"
             alt="川味火锅">
        <div class="dish-info">
          <h3>川味火锅</h3>
          <div class="rating">
            <i class="fas fa-star"></i>4.7
          </div>
          <div class="badge">🔥 套餐7折</div>
          <p class="price-tag">人均 ¥78</p>
        </div>
      </article>
    </div>
  </section>
</main>

<nav class="bottom-nav">
  <a href="ShoppingCentre.html" class="nav-item">
    <i class="fas fa-home"></i>
    <span>首页</span>
  </a>
  <a href="#" class="nav-item active">
    <i class="fas fa-search"></i>
    <span>发现</span>
  </a>
  <a href="ShoppingCart.html" class="nav-item">
    <i class="fas fa-shopping-cart"></i>
    <span>购物车</span>
  </a>
  <a href="It'smine.html" class="nav-item">
    <i class="fas fa-user"></i>
    <span>我的</span>
  </a>
</nav>

<script>
  document.addEventListener('DOMContentLoaded', () => {
    // 卡片加载动画
    const animateCards = () => {
      const cards = document.querySelectorAll('.dish-card');
      cards.forEach((card, index) => {
        setTimeout(() => {
          card.classList.add('visible');
        }, index * 150);
      });
    }

    // 筛选标签交互
    const tags = document.querySelectorAll('.filter-tag');
    tags.forEach(tag => {
      tag.addEventListener('click', () => {
        tags.forEach(t => t.classList.remove('active'));
        tag.classList.add('active');
        animateCards();
      });
    });

    // 搜索框交互
    const searchInput = document.querySelector('.search-input');
    searchInput.addEventListener('focus', () => {
      searchInput.parentElement.style.transform = 'scale(1.02)';
    });
    searchInput.addEventListener('blur', () => {
      searchInput.parentElement.style.transform = 'scale(1)';
    });

    // 导航切换
    const navItems = document.querySelectorAll('.nav-item');
    navItems.forEach(item => {
      item.addEventListener('click', (e) => {
        navItems.forEach(nav => nav.classList.remove('active'));
        item.classList.add('active');
      });
    });

    // 登录状态处理
    const token = sessionStorage.getItem('token');
    const loginPrompt = document.getElementById('loginPrompt');
    const bottomNav = document.querySelector('.bottom-nav');

    if (!token) {
      loginPrompt.style.display = 'flex';
      const promptHeight = loginPrompt.offsetHeight;
      bottomNav.style.transform = `translateY(-${promptHeight}px)`;
    }else{
      bottomNav.style.bottom = '0';
    }

    window.addEventListener('resize', () => {
      if (!token) {
        const promptHeight = loginPrompt.offsetHeight;
        bottomNav.style.transform = `translateY(-${promptHeight}px)`;
      }
    });

    animateCards();
  });
</script>
</body>
</html>
